USE GESTION2

go
IF OBJECT_ID('dbo.WASP_D0004_CREA_TABLA_FAX') IS NOT NULL
BEGIN
    DROP PROCEDURE dbo.WASP_D0004_CREA_TABLA_FAX
    IF OBJECT_ID('dbo.WASP_D0004_CREA_TABLA_FAX') IS NOT NULL
        PRINT '<<< FAILED DROPPING PROCEDURE dbo.WASP_D0004_CREA_TABLA_FAX >>>'
    ELSE
        PRINT '<<< DROPPED PROCEDURE dbo.WASP_D0004_CREA_TABLA_FAX >>>'
END
go
SET ANSI_NULLS ON
go
SET QUOTED_IDENTIFIER ON
go
CREATE PROCEDURE [dbo].[WASP_D0004_CREA_TABLA_FAX]
AS

BEGIN

select ctnro, max (dofax) fax1, min (dofax) fax2 into dbo.fax 
from fsr006  (nolock) group by ctnro

END
go
SET ANSI_NULLS OFF
go
SET QUOTED_IDENTIFIER OFF
go
IF OBJECT_ID('dbo.WASP_D0004_CREA_TABLA_FAX') IS NOT NULL
    PRINT '<<< CREATED PROCEDURE dbo.WASP_D0004_CREA_TABLA_FAX >>>'
ELSE
    PRINT '<<< FAILED CREATING PROCEDURE dbo.WASP_D0004_CREA_TABLA_FAX >>>'
go
